Repository navigation
feat(libressl3): implement EVP_PKEY_bits - #14409
Conversation
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
The EVP_PKEY_bits export dispatches through the method's pkey_bits slot and returns zero for null keys, methods and callbacks, as the PR says; the slot offset 104 is correct for the LibreSSL 4.0.0 layout the PR cites, but whether the console's library follows that layout is not known here, and the repository does not record it.
What I ran
- Exact head
aa4fc310feb23ba86c31d0ce1c5786c8543692a0, baseba627802e2210187d417deb64c8f2fed8e33011f. - Environment: Linux,
/usr/bin/python33.11.2, no build. - Precheck:
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14409 --output-dir /dev/shm/reviewer-run/precheck/14409 - ABI audit by hand (helper absent from the head tree):
python3 tools/pr_abi_audit.py --repo /marc/AnyPS5 --base ba627802e2210187d417deb64c8f2fed8e33011f --head aa4fc310feb23ba86c31d0ce1c5786c8543692a0 --json(exit 0;passed; 0 findings; 270 symbols). - Test-quality helper on
core/libs/tests/GuestLibreSsl3KeyReference.cppfrom a head extract: one literal-path registration heuristic. - Offset check: the LibreSSL 4.0.0 structure
evp_pkey_asn1_method_stinsrc/lib/libcrypto/evp/evp_local.hatce488b78e0bd994780569df718596b9776ff681a(fetched withgh api). Counting LP64 offsets:base_method0,pkey_id8,pkey_flags16,pem_str24,info32, the six pub/priv callbacks 40 to 80,pkey_size96,pkey_bits104. The value 104 matches.
Results
Precheck report, checks table, unedited (/dev/shm/reviewer-run/precheck/14409/report.md):
| Check | Status | Command / reason |
|---|---|---|
| build_and_compile | not_applicable | The precheck deliberately does not configure, build, or compile AnyPS5. |
| diff_check | passed | git diff --check ba627802e2210187d417deb64c8f2fed8e33011f...aa4fc310feb23ba86c31d0ce1c5786c8543692a0 |
| conventions_and_pr_template | passed | /usr/bin/python3 tools/check_conventions.py --base ba627802e2210187d417deb64c8f2fed8e33011f --head aa4fc310feb23ba86c31d0ce1c5786c8543692a0 --title feat(libressl3): implement EVP_PKEY_bits --body /dev/shm/reviewer-run/precheck/14409/pr-body.md |
| changed_export_abi_audit | failed | /usr/bin/python3 tools/pr_abi_audit.py --base ba627802e2210187d417deb64c8f2fed8e33011f --head aa4fc310feb23ba86c31d0ce1c5786c8543692a0 --json |
| python_syntax | not_applicable | No changed Python implementation files. |
| related_python_unit_tests | not_applicable | No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite. |
| python_test_registration | not_applicable | No changed test_*.py files. |
| live_dependency_and_mergeability_check | passed | /usr/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14409 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14409/stack |
| build_dependent_cpp_tests | not_applicable | Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build. |
| test_quality_heuristics | failed | /usr/bin/python3 /dev/shm/reviewer-run/precheck/14409/head-aa4fc310feb2-1a9f74f7/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14409/head-aa4fc310feb2-1a9f74f7 --json core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp core/libs/prx/libSceLibreSsl3/CMakeLists.txt core/libs/prx/libSceLibreSsl3/include/Api.hpp core/libs/prx/libSceLibreSsl3/src/Key.cpp core/libs/tests/GuestLibreSsl3KeyReference.cpp docs/dev/debt/libSceLibreSsl3.md |
| negative_controls | not_applicable | No changed Python test module in tools/ can be run as a no-build base-source control. |
Negative control
Not run here. The guest test is C++ and needs a build. The test writes a neighbouring method slot at 96 and checks that dispatch picks the slot at 104, which tests the code's constant, not the console's layout.
Findings
Blocking: none.
Non-blocking:
- The offset is the 4.0.0 layout. In the 4.0.0 struct a
base_methodpointer replaces the 3.xpkey_base_idfield, which is why the slot moves. I believe a 3.x layout would putpkey_bitsat 96, but I did not fetch a 3.x header here, so that is an inference. The library's technical-debt entry says "no console ABI or behavior verification" and cites 4.0.0; it should also state the revision thelibSceLibreSsl3export is assumed to follow, and that the offset depends on it. - The method-slot read has no bounds check against the method object's size. That is the same trust the existing key model places in caller-owned methods (PR body: "Coverage uses caller-owned keys/methods").
Sources
- LibreSSL 4.0.0 method struct (commit-pinned): https://github.com/libressl/openbsd/blob/ce488b78e0bd994780569df718596b9776ff681a/src/lib/libcrypto/evp/evp_local.h#L92-L113
- Dispatch at head:
AnyPS5/core/libs/prx/libSceLibreSsl3/src/Key.cpp
Lines 32 to 39 in aa4fc31
Not verified
- The LibreSSL revision the console's
libSceLibreSsl3follows; the 3.x layout was not fetched. - The C++ test was not built or run here.
- Hosted: at this head
conventions,eligibility,intake,labelsandlibrary-portabilitysucceeded;linux,register-context,relinker,relinker-asanandwrite-watchwere skipped.
|
The Windows job exceeded its 45-minute limit while compiling guest tests, before a test verdict. Could a maintainer rerun it? https://github.com/boykopovar/AnyPS5/actions/runs/41436303787/job/125252365322 . The author UI has no rerun control, and the GitHub connector returns 403. |
✅ AMD GPU test: passedPR head
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (5, not counted against this PR)Validation IDs already present on main (4 IDs in 490 tests)Skipped (7)ReproduceAutomated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
EVP_PKEY_bits follows LibreSSL 4.0.0 and its method-table offset (104) matches that revision's struct; the Windows job on this head was cancelled, and I did not build or run the new test.
What I ran
Head 2573684d24be67e6b0dde001c01a1d5a43fa24cb, PR base ba627802e2210187d417deb64c8f2fed8e33011f. I read the whole diff (6 files) and the head's Key.cpp, and compared them with LibreSSL 4.0.0 (p_lib.c and evp_local.h at ce488b78e0bd994780569df718596b9776ff681a). Environment: Debian 12, Linux x86_64. No AnyPS5 build was run.
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14409
gh pr diff 14409 -R boykopovar/AnyPS5
gh api 'repos/boykopovar/AnyPS5/contents/core/libs/prx/libSceLibreSsl3/src/Key.cpp?ref=2573684d24be67e6b0dde001c01a1d5a43fa24cb'
curl -sL https://raw.githubusercontent.com/libressl/openbsd/ce488b78e0bd994780569df718596b9776ff681a/src/lib/libcrypto/evp/p_lib.c
curl -sL https://raw.githubusercontent.com/libressl/openbsd/ce488b78e0bd994780569df718596b9776ff681a/src/lib/libcrypto/evp/evp_local.h
gh pr checks 14409 -R boykopovar/AnyPS5Results
| Check | Result | Note |
|---|---|---|
| Diff check, conventions, template | passed | precheck |
| Export and ABI audit | passed | precheck |
| Test-quality heuristic | passed | precheck |
| Merge and dependency preview | passed | precheck |
| Behavior against LibreSSL 4.0.0 | passed | null key, method or callback gives 0 |
| Method-table offset 104 | passed | counted from the struct on LP64 |
| Debt-entry export count | passed | 176 to 175 for the removed stub; named and NID-only split now 165 and 10, in line with the 116 names the entry records |
| Hosted Windows build | not run | job was cancelled on this head |
| Hosted conventions, labels, portability | passed | |
| AMD GPU CI comment on this head | not run | reports a passing build, no new failures |
| Local build and the new test | not run |
Precheck report for this head, unedited table
| Check | Status | Why / command |
|---|---|---|
| build_and_compile | not_run | Builds are intentionally excluded from this fast, no-build check pass. |
| diff_check | passed | Command ran; see raw output below. Command: git diff --check ba627802e2210187d417deb64c8f2fed8e33011f...2573684d24be67e6b0dde001c01a1d5a43fa24cb |
| conventions_and_pr_template | passed | Command ran; see raw output below. Command: /marc/DeusMachina_0x1914/.venv/bin/python3 tools/check_conventions.py --base ba627802e2210187d417deb64c8f2fed8e33011f --head 2573684d24be67e6b0dde001c01a1d5a43fa24cb --title feat(libressl3): implement EVP_PKEY_bits --body /tmp/anyps5-pr-precheck/final/14409/pr-body.md |
| changed_export_abi_audit | passed | Command ran; see raw output below. Command: /marc/DeusMachina_0x1914/.venv/bin/python3 /marc/AnyPS5/tools/pr_abi_audit.py --base ba627802e2210187d417deb64c8f2fed8e33011f --head 2573684d24be67e6b0dde001c01a1d5a43fa24cb --json |
| python_syntax | not_applicable | No changed Python implementation files. |
| related_python_unit_tests | not_applicable | No changed Python tool module has a related tools/tests/test_.py suite. |
| python_test_registration | not_applicable | No changed Python test files need registration. |
| live_dependency_and_mergeability_check | passed | Command ran; see raw output below. Command: /marc/DeusMachina_0x1914/.venv/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14409 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-pr-precheck/final/14409/stack |
| build_dependent_cpp_tests | not_run | Changed C/C++ source or test files need exact-head binaries; this fast pass does not build. |
| test_quality_heuristics | passed | Command ran; see raw output below. Command: /marc/DeusMachina_0x1914/.venv/bin/python3 /marc/AnyPS5/tools/pr_test_quality.py --root /tmp/anyps5-pr-precheck/final/14409/head-2573684d24be-798d46cd --json core/libs/prx/libSceLibreSsl3/AdditionalExports.cpp core/libs/prx/libSceLibreSsl3/CMakeLists.txt core/libs/prx/libSceLibreSsl3/include/Api.hpp core/libs/prx/libSceLibreSsl3/src/Key.cpp core/libs/tests/GuestLibreSsl3KeyReference.cpp docs/dev/debt/libSceLibreSsl3.md |
| negative_controls | not_applicable | No changed tools/ Python test module is eligible for a base-source negative control. |
Negative control
Not run. The new CheckBits test covers a null key, a key without a method, a neighbouring slot (offset 96) holding a failing callback, a removed callback and eight callback results; I read it but did not run it.
Findings
Blocking
None.
Non-blocking
None.
Sources
- Offset constant:
EVP_PKEY_bits_nid_postfix:AnyPS5/core/libs/prx/libSceLibreSsl3/src/Key.cpp
Lines 32 to 38 in 2573684
- LibreSSL
EVP_PKEY_bits: https://github.com/libressl/openbsd/blob/ce488b78e0bd994780569df718596b9776ff681a/src/lib/libcrypto/evp/p_lib.c#L262-L267 - LibreSSL method table (
pkey_sizethenpkey_bits): https://github.com/libressl/openbsd/blob/ce488b78e0bd994780569df718596b9776ff681a/src/lib/libcrypto/evp/evp_local.h#L92-L112
Not verified
- Compilation and the new
guest_libressl3_pkey_bitstest on any platform. The AMD GPU CI comment is another contributor's report, not my run. - The hosted Windows build: the job was cancelled on this head (the author reports it hit the 45-minute limit).
- The console module's LibreSSL revision and method layout; the debt entry already says they are unverified.
To get this to a good state
- Get the hosted Windows build to complete on
2573684d24be67e6b0dde001c01a1d5a43fa24cb; a maintainer has to rerun it.
2573684 to
c8541e6
Compare
|
Hi @DonRyuzaki, Main has moved since this branch and the PR now conflicts in the LibreSsl3 debt count line. We have a merge of current main ready that keeps your implementation unchanged and recounts the pending exports (it also fixes the count noted in the last review), and it builds and passes the LibreSsl3 tests. We cannot push it because "Allow edits by maintainers" is off on this branch. Could you either turn on "Allow edits by maintainers" so we can push the merge, or merge current main into the branch yourself? Either way this is ready to merge right after. |
|
Hi @DonRyuzaki, thanks for merging main yourself; the conflict is gone and your
If you'd rather we made this change for you, ticking "Allow edits by maintainers" on the PR lets us push it. |
|
@oneandonlydean Thanks for catching the two count lines. I verified 46 throwing exports in |
What
Resubmission of #13941 after the author's PR allowance increased. The original was automatically closed for the earlier PR limit and remains closed; this PR supersedes it.
Implement
EVP_PKEY_bitsin the existinglibSceLibreSsl3library, replacing its throwing unknown-signature placeholder withint (const LibreSsl3EvpPkey*). Null keys, methods and callbacks return zero; otherwise dispatch through the method'spkey_bitscallback with the original key and preserve its result.The contract follows LibreSSL 4.0.0 p_lib.c. The existing key model places the method at offset 8; the callback at offset 104 follows that revision's LP64
evp_local.h. Record the unverified console ABI and constructor interoperability in the library's technical debt. This adds one function to an existing library and no third-party dependency.Add a registered regression test covering null paths, the neighboring callback slot, original argument forwarding, exact callback count, signed return values, unchanged input objects and replacement/removal of the callback. The existing key-reference test also runs this coverage by default.
Tested
Windows x86-64, WinLibs GCC 15.2 DWARF, Release with bundled dependencies and BUILD_TESTING=ON. Tested local commit
a99b4c27f90c32076d79d573fc20a15b820b6576, based on upstreamba627802e2210187d417deb64c8f2fed8e33011f. Publishedaa4fc310feb23ba86c31d0ce1c5786c8543692a0has exactly the tested tree6777f6e55ad6f9a63d1107b890b7f84e0ed1f4af.libs,relinker, and all focused test targets with two compiler jobs.patched_libraries,strict_nid_filter,guest_libressl3_pkey_bits,guest_libressl3_key_reference,guest_libressl3_pkey_getters, andguest_crypto_memcmp.test_public_headers.py --audit-only: 399 libraries / 26,227 exports, unique declarations and umbrella coverage verified.check_conventions.py --base origin/mainandgit diff --check origin/main HEADpassed.pr_overlap.py --branch feat/pkey-bits-currentused a fresh 1,648-head REST snapshot, unchanged comparison logic, and exact-base/head caches verified against live upstreamba627802e2210187d417deb64c8f2fed8e33011f. It returned 2: shared-line overlap with feat(libSceLibreSsl3): implement numeric object identifier text parsing #12315 (debt insertion), feat(libSceLibreSsl3): implement BIO_up_ref #12945 (retain-helper extraction/test dispatch), and feat(libSceLibreSsl3): implement RSA_get0_factors and RSA_get0_crt_params #14366 (RSA getter debt insertion/inventory); comparisons remained unverified for feat(libressl3): report OpenSSL version strings #9970, feat(libSceLibreSsl3): implement ASN1_STRING_get0_data and ASN1_INTEGER_free #10452, feat(libSceLibreSsl3): implement ASN1_OBJECT_free #10461, feat(libSceLibreSsl3): implement the RSA, DH and DSA get0 key and parameter accessors #10490, feat(libSceLibreSsl3): implement the X509 notBefore, notAfter and signature getters #10491, feat(libSceLibreSsl3): implement X509_get0_extensions, X509_get_ext_count and X509_get_ext #10493, feat(libSceLibreSsl3): implement X509 public key parameters #10557, feat(libSceLibreSsl3): implement OBJ_cmp #10631, feat(libSceLibreSsl): implement EC_KEY_get0_private_key and EC_KEY_set_private_key #11146, feat(libSceLibreSsl3): implement the SSL_CTX, SSL, SSL_SESSION and X509 retains, the SSL_CTX version bounds, SSL_get_client_random and X509_get_version #12754, and docs(debt): separate entries with blank lines and drop derived export totals #14212 because those peers conflict with the base. Every reported peer's actual shared patch, plus the refreshed feat(libSceLibreSsl3): implement EVP digest contexts and SHA methods #10960 digest-helper patch, was manually compared at its exact head: none implements EVP_PKEY_bits. Preserve both sets of changes when resolving the helper/test/debt hunks. This does not claim that those peers merge cleanly; this function does not depend on their implementations.Console ABI and native key-constructor interoperability remain unverified and are recorded in the library's technical debt. Coverage uses caller-owned keys/methods. Validation here is Windows-only and focused; no entire-CTest-suite or title-compatibility claim.
Documentation follow-up (November 2, 2026): explicitly state that the console module's LibreSSL revision is unknown and that callback offset 104 assumes LibreSSL 4.0.0's LP64
EVP_PKEY_ASN1_METHODlayout. This follow-up changes only the debt entry; all code/build inputs are identical to the previously tested tree above. Re-ran the 399-library / 26,227-export public-header audit and the same six previously built runtime regressions: all passed. Current-main conventions and whitespace checks passed. This is not a new full-runtime build or console ABI verification.Published follow-up
2573684d24be67e6b0dde001c01a1d5a43fa24cbhas exactly the validated local treeec185ba24382c808aa99c0286a941c5d16303898(local source89a4e19f48a30d9315ebeb8908396ba0d223a239).Current-main refresh (November 5, 2026): rebased the unchanged feature onto upstream main
e772fb25cc72ee5faf77847f06bbc69533016e82. Published headc8541e6841e3326d7f7b420ad3282b11d5473a3fhas treec8333a93c071393d79311f4ae29cd336ec4831a7; the worktree was clean. An isolated native Windows Release configuration succeeded using WinLibs GCC 15.2 and the pinned FFmpeg package. Theguest_libressl3_key_reference_teststarget built successfully (352 Ninja steps, two below-normal compiler jobs). Focused CTestsguest_libressl3_pkey_bitsandguest_libressl3_key_referenceeach passed three consecutive runs, with no skips. Current-main conventions and whitespace checks passed. This refresh did not repeat the fulllibs/relinkerbuild, public-header audit, entire CTest suite, console ABI check, or game test; the earlier full-build evidence above applies to the older tree. The old hosted Windows job was cancelled at its 45-minute limit during guest-test compilation, before a test verdict. The refreshed head triggered a new Build run, initially queued. The localpr_overlap.pycould not run becauseghis unavailable here; a live GitHub PR search found no other open PR claimingEVP_PKEY_bits, but did not prove whole-repository line-overlap freedom.Current-main merge (November 6, 2026): merged upstream main through
c28413dda903edcfe7fe9d544abe1b7786cb0e31into the existing branch. Published head533a4fe645f1419a55a55d8c77cf2fb73c409207has tree5777d5ff7774734274822985c99518be61ab7998and a clean working tree. The feature diff against this main is six files. Conflict resolution keeps the upstreamRetain_nid_no_patchhelper andssl_ctxtest case, retains theEVP_PKEY_bitsimplementation and test, and retains the upstream parent-forwarding count of 391. The initial pending-export count was corrected in the November 6 follow-up below.On native Windows x64, Release CMake configuration and the
guest_libressl3_key_reference_teststarget build passed with GCC 15.2 and two below-normal compiler jobs. The registeredguest_libressl3_pkey_bitsandguest_libressl3_key_referencetests each passed three consecutive executions (2 tests, 0 failures/skips).git diff --check origin/main HEADpassed.check_conventions.py --base origin/main --head HEADcompleted with 0 errors and one debt-entry length warning on that intermediate tree. This merge did not rerun the fulllibs/relinker build, whole CTest suite, public-header audit, console ABI check, or game test. The November 5 refreshed head's Build run later succeeded; fresh hosted checks for this merge are separate.Latest-main merge and review correction (November 6, 2026): merged upstream main through
e509b292479c383dabd18bf5c323eff1afe9d2f3and published headb85b547dcf8bd1695c540de83fd66e3e7add2b58(tree3db5b072f0db35524f9a08b8badbfffe20aa8a80). The worktree is clean and the feature diff remains six files, with 83 additions and 7 deletions. This merge retains upstream native PKEY lifecycle changes and its 387 parent export forwarders without changing theEVP_PKEY_bitsimplementation. Dean's count review was verified against the source:Export.cpphas 46 throwing exports, whileAdditionalExports.cpphas 164 remaining callable exports (154 named and 10 NID-only). The debt document now records those counts on the corresponding lines.On native Windows x64, the Release
guest_libressl3_key_reference_teststarget rebuilt successfully with GCC 15.2 (217 Ninja steps; two below-normal compiler jobs). The registeredguest_libressl3_pkey_bitsandguest_libressl3_key_referencetests each passed three consecutive runs, with no failures or skips. On the final documentation-only follow-up,check_conventions.py --base origin/main --head HEADpassed with no findings, andgit diff --check origin/main HEADpassed. The focused executable did not need rebuilding after the documentation-only correction. This update did not repeat the fulllibs/relinker build, whole CTest suite, console ABI check, or game test; hosted checks for this head are new and pending. Maintainer edits were enabled for this PR on November 6 at the author's request.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)